[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
USER HOOKS

     The four IOTTT5 user hooks are:

Insert Hook

     The insert hook is called every time the user presses the insert key.
     The procedure must be declared with a single passed parameter of type
     boolean, e.g.

          {$F+}
          PROCEDURE SPECIAL_INS_HOOK(INSERTON:BOOLEAN);
          BEGIN
                    ...........
          END;
          {$F-}

     The parameter is passed the new state of the insert key, i.e. the
     state of the insert key is swapped before it is passed to the
     procedure.

     The default procedure sets the cursor to a full block in Overtype mode
     and an underscore in Insert Mode. The hook allows the programmer to
     develop some other method of indicating the insert status, e.g.
     writing "INSERT" or "REPLACE" somewhere on the screen.

Character Hook

     The character hook is a procedure that will be called every time the
     user presses a key. The procedure must be declared with three passed
     parameters of type char, byte and byte, e.g.

          {$F+}
          PROCEDURE MY_CHAR_HOOK(VAR CH:CHAR;VAR ID:BYTE; VAR
                                     REFRESH:BYTE);
          BEGIN
                    ...........
          END;
          {$F-}

     The first passed parameter is the actual character that the user just
     pressed. The character is not adjusted before it is passed to the
     hooked procedure, e.g. it is not converted to upper case even if the
     format character is '!'.

     The second parameter is the field ID number of the current field. This
     field number can be changed to cause the cursor to go to another
     field.

     The third parameter is the refresh code that is passed back to the IO
     routines. This code advises the Toolkit how to proceed and can be set
     to one of four values. The following valid codes are defined as
     constants in the interface section of the unit:

     Refresh_None - continue with the normal update process, i.e. do not
     perform any special tasks as a result of the hooked procedure.

     Refresh_Current - immediately refresh the current field. This code is
     normally used when the hooked procedure has modified the variable
     assigned to the current field.

     Refresh_All - immediately refresh all the fields. This code is
     normally used when the hooked procedure has modified more than one of
     the assigned variables.

     End_Input - this terminates the input session just as though the user
     had pressed the F10 key.

Leave Field Hook

     The leave field hook is called every time the user tries to move to
     another input field, e.g. when the user presses the Enter key or the
     up arrow. The hooked procedure must be declared with two variable byte
     parameters, e.g.

          {$F+}
          PROCEDURE LEAVE_HOOK(VAR ID:BYTE; VAR REFRESH:BYTE);
          BEGIN
                    ...........
          END;
          {$F-}


     These parameters are the current field ID number, i.e. the number of
     the field that the user is leaving, and the refresh code. These two
     parameters operate in exactly the same way as identified in the
     character hook, described above.

Enter Field Hook

     This hook is very similar to the leave field hook, except that it is
     called every time a user enters a new field. The hooked procedure must
     be declared with two variable byte parameters, e.g.

          {$F+}
          PROCEDURE ENTER_HOOK(VAR ID:BYTE; VAR REFRESH:BYTE);
          BEGIN
                    ...........
          END;
          {$F-}


     These parameters are the new field ID number, i.e. the number of the
     field that the user is entering and the refresh code. These two
     parameters operate in exactly the same way as identified in the
     character hook, described above.

     The technique of assigning or hooking these procedures for Turbo
     Pascal 5.0 is different from Turbo Pascal 4.0:

     Turbo 5 Users - there are four procedures that are passed the name of
     the hooked procedure:

          Assign_InsHook
          Assign_CharHook
          Assign_LeaveFieldHook
          Assign_EnterFieldHook
     e.g.
          ASSIGN_INSHOOK(SPECIAL_INS_HOOK);
          ASSIGN_CHARHOOK(MY_CHAR_HOOK);
          ASSIGN_LEAVEFIELDHOOK(LEAVE_HOOK);
          ASSIGN_ENTERFIELDHOOK(ENTER_HOOK);

     Turbo 4 Users - there are four global variables of type pointer that
     should be pointed to the hooked procedure with the @ assignment:

          IO_InsertHook
          IO_CharHook
          IO_LeaveHook
          IO_EnterHook
     e.g.
          IO_INSERTHOOK := @SPECIAL_INS_HOOK;
          IO_CHARHOOK := @MY_CHAR_HOOK;
          IO_LEAVEHOOK := @LEAVE_HOOK;
          IO_ENTERHOOK := @ENTER_HOOK;

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson